﻿using System;
using System.Collections.Generic;
using System.Web.Security;
using VASJ.Model;

namespace VASJ.Provider
{
    public class AcpInetHelper
    {
        /// <summary>
        /// GetProjectType
        /// </summary>
        /// <param name="UserName"></param>
        /// <returns></returns>
        public static List<string> GetProjectTypes(string UserName)
        {
            return (new AcpInetHelperProvider()).GetProjectTypesForApplication(UserName);
        }

        /// <summary>
        /// Get All project for project type
        /// </summary>
        /// <returns></returns>
        
        /// <summary>
        /// Check user in project
        /// </summary>
        /// <param name="username"></param>
        /// <param name="projectid"></param>
        /// <returns></returns>
        public static bool IsUserInProject(string username, int projectid)
        {
            return (new AcpInetHelperProvider()).IsUserInProject(username, projectid);
        }

        /// <summary>
        /// Get the project for projectId
        /// </summary>
        /// <param name="projectId"></param>
        /// <returns></returns>
        public static Organization GetOrganization(int organizationId)
        {
            return (new AcpInetHelperProvider()).GetOrganization(organizationId);
        }


        /// <summary>
        /// Get project for user
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public static int[] GetProjectForUser(string username, string rolename, string projectType, int linkProject, bool include_via_org = false)
        {
            return (new AcpInetHelperProvider()).GetProjectForUser(username, rolename, projectType, linkProject, include_via_org);
        }

        /// <summary>
        /// Get Use in project
        /// </summary>
        /// <param name="projectid"></param>
        /// <returns></returns>
        public static Dictionary<Guid, string> GetUserInProject(int projectid)
        {
            return (new AcpInetHelperProvider()).GetUserInProject(projectid);
        }

        /// <summary>
        /// Get Use in project
        /// </summary>
        /// <param name="projectid"></param>
        /// <returns></returns>
        public static Dictionary<Guid, User> GetListUserInProject(int projectid)
        {
            return (new AcpInetHelperProvider()).GetListUserInProject(projectid);
        }

        /// <summary>
        /// Author: Hoang Van Tai
        /// Get list user is waiting accept for project
        /// </summary>
        /// <param name="projectid"></param>
        /// <returns></returns>
        public static User[] GetWaitingAcceptUserForProject(int projectid)
        {
            return (new AcpInetHelperProvider()).GetWaitingAcceptUserForProject(projectid);
        }

        /// <summary>
        /// Get list Use in project
        /// </summary>
        /// <returns></returns>
        public static Dictionary<Guid, User> GetListUser()
        {
            return (new AcpInetHelperProvider()).GetListUser();
        }

        /// <summary>
        /// Add user to project
        /// </summary>
        /// <param name="username"></param>
        /// <param name="projectid"></param>
        public static void AddUserToProject(string username, int projectid)
        {
            (new AcpInetHelperProvider()).AddUserToProject(username, projectid);
        }

        /// <summary>
        /// InviteUsersToProject
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="projectID"></param>
        /// <returns></returns>
        public static int InviteUsersToProject(string[] userId, int projectID)
        {
            return (new AcpInetHelperProvider()).InviteUsersToProject(userId, projectID);
        }

        /// <summary>
        /// AcceptInvitedUserToProject
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="projectId"></param>
        /// <param name="isAccept"></param>
        /// <returns></returns>
        public static int AcceptInvitedUserToProject(string userId, int projectId, bool isAccept)
        {
            return (new AcpInetHelperProvider()).AcceptInvitedUserToProject(userId, projectId, isAccept);
        }

        /// <summary>
        /// Add user to project
        /// </summary>
        /// <param name="username"></param>
        /// <param name="projectid"></param>
        public static bool AddUserToProject(string username, int projectid, string roleName)
        {
            return (new AcpInetHelperProvider()).AddUserToProject(username, projectid, roleName);
        }

        /// <summary>
        /// Create project type
        /// </summary>
        public static void CreateProjectType()
        {
            (new AcpInetHelperProvider()).CreateProjectType();
        }

        /// <summary>
        /// CreateRoleForProjectType
        /// </summary>
        public static void CreateRoleForProjectType()
        {
            (new AcpInetHelperProvider()).CreateRoleForProjectType();
        }
        
        /// <summary>
        /// Get Organization for Project
        /// </summary>
        /// <returns></returns>
        public static Dictionary<Guid, Organization> GetOrganization()
        {
            return (new AcpInetHelperProvider()).GetOrganization();
        }

        /// <summary>
        /// Get Organization By PrimaryKey
        /// </summary>
        /// <param name="OrgId"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static Organization GetOrganizationById(string OrgId, ref string msgError)
        {
            return (new AcpInetHelperProvider()).GetOrganizationById(OrgId, ref msgError);
        }

        /// <summary>
        /// Get User In Organization
        /// </summary>
        /// <param name="OrgID"></param>
        /// <returns></returns>
        public static Dictionary<Guid, MembershipUser> GetUserInOrganization(Guid OrgID)
        {
            return (new AcpInetHelperProvider()).GetUserInOrganization(OrgID);
        }

        /// <summary>
        /// Add User to Organization
        /// </summary>
        /// <param name="OrgID"></param>
        /// <returns></returns>
        public static bool AddUserToOrgs(Guid UserID, string[] idOrgs, ref string msg)
        {
            return (new AcpInetHelperProvider()).AddUserToOrgs(UserID, idOrgs, ref msg);
        }

        /// <summary>
        /// Add User to Project
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="idProjs"></param>
        /// <returns></returns>
        public static bool AddUserToProjects(Guid UserID, string[] idProjs)
        {
            return (new AcpInetHelperProvider()).AddUserToProjects(UserID, idProjs);
        }

        /// <summary>
        /// Remove user from all project
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public static bool RemoveUserFromProjects(Guid UserID)
        {
            return (new AcpInetHelperProvider()).RemoveUserFromProjects(UserID);
        }

        /// <summary>
        /// Remove user from all project
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public static bool RemoveUserFromProject(int projectId, string username, string rolename = null)
        {
            return (new AcpInetHelperProvider()).RemoveUserFromProject(projectId, username, rolename);
        }

        /// <summary>
        /// Remove user from all organization
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public static bool RemoveUserFromOrgs(Guid UserID)
        {
            return (new AcpInetHelperProvider()).RemoveUserFromOrgs(UserID);
        }

        /// <summary>
        /// Author: Hoang Van Tai
        /// Remove user from all project for CS
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public static bool RemoveUserFromProjectsForCS(Guid UserID, Int32[] idPrjDels, ref string message)
        {
            return (new AcpInetHelperProvider()).RemoveUserFromProjectsForCS(UserID, idPrjDels, ref message);
        }

        /// <summary>
        /// Author: Hoang Van Tai
        /// Remove user from all organization for CS
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public static bool RemoveUserFromOrgsForCS(Guid UserID, string[] idOrgDels, ref string message)
        {
            return (new AcpInetHelperProvider()).RemoveUserFromOrgsForCS(UserID, idOrgDels, ref message);
        }

        /// <summary>
        /// Delete project
        /// </summary>
        /// <param name="ProjectID"></param>
        /// <returns></returns>
        public static bool DeleteProject(int ProjectID)
        {
            return (new AcpInetHelperProvider()).DeleteProject(ProjectID);
        }

        /// <summary>
        /// Get role for user
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public static Dictionary<Guid, Role> GetRolesForUser(string username)
        {
            return (new AcpInetHelperProvider()).GetRolesForUser(username);
        }

        /// <summary>
        /// Get roles for user in project
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public static string[] GetRolesForUser(int projectId, string username)
        {
            return (new AcpInetHelperProvider()).GetRolesForUserInProject(projectId, username);
        }

        /// <summary>
        /// Get users in role for project
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="rolename"></param>
        /// <returns></returns>
        public static string[] GetUsersInRole(int projectId, string rolename, bool include_via_org = true)
        {
            return (new AcpInetRoleProvider()).GetUsersInRole(projectId, rolename, include_via_org);
        }

        /// <summary>
        /// Add Organization
        /// </summary>
        /// <returns>bool</returns>
        public static bool AddOrganization(string name, string description, string[] idUsers, string[] idPrjRoles, Guid OwnerID)
        {
            return (new AcpInetHelperProvider()).AddOrganization(name, description, idUsers, idPrjRoles, OwnerID);
        }

        /// <summary>
        /// Update Organizaiton
        /// </summary>
        /// <returns>bool</returns>
        public static bool UpdateOrganization(Guid OrgID, string name, string description, string[] idUsers, string[] idPrjRoles)
        {
            return (new AcpInetHelperProvider()).UpdateOrganization(OrgID, name, description, idUsers, idPrjRoles);
        }

        /// <summary>
        /// Update Organizaiton
        /// </summary>
        /// <returns>bool</returns>
        public static bool UpdateOrganization(Guid OrgID, string name, string description, string[] idUsers)
        {
            return (new AcpInetHelperProvider()).UpdateOrganization(OrgID, name, description, idUsers);
        }

        /// <summary>
        /// Delete Organization
        /// </summary>
        /// <returns></returns>
        public static bool DeleteOrganizaion(Guid OrgID)
        {
            return (new AcpInetHelperProvider()).DeleteOrganization(OrgID);
        }

        /// <summary>
        /// RemoveOrgsFromProject
        /// </summary>
        /// <param name="ProjectID"></param>
        /// <returns></returns>
        public static bool RemoveOrgsFromProject(int ProjectID)
        {
            return (new AcpInetHelperProvider()).RemoveOrgsFromProject(ProjectID);
        }

        /// <summary>
        /// Delete MainProject
        /// </summary>
        /// <param name="ProjectID"></param>
        /// <returns></returns>
        public static bool DeleteMainProject(int ProjectID)
        {
            return (new AcpInetHelperProvider()).DeleteMainProject(ProjectID);
        }

        /// <summary>
        /// Add Organization to Project
        /// </summary>
        /// <param name="ProjectID"></param>
        /// <param name="idOrgs"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static bool AddOrgsToProject(int ProjectID, string[] idOrgs, ref string message)
        {
            return (new AcpInetHelperProvider()).AddOrgsToProject(ProjectID, idOrgs, ref message);
        }

        /// <summary>
        /// Add new project
        /// </summary>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="owner"></param>
        /// <param name="idUserRoles"></param>
        /// <param name="idOrgRoles"></param>
        /// <returns></returns>
        public static int AddProject(string name, string description, string owner, string[] idUserRoles, string[] idOrgRoles)
        {
            return (new AcpInetHelperProvider()).AddProject(name, description, owner, idUserRoles, idOrgRoles);
        }

        /// <summary>
        /// Update project
        /// </summary>
        /// <param name="mainPrjId"></param>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="owner"></param>
        /// <param name="idUserRoles"></param>
        /// <param name="idOrgRoles"></param>
        /// <returns></returns>
        public static int UpdateProject(int mainPrjId, string name, string description, string owner, string[] idUserRoles, string[] idOrgRoles)
        {
            return (new AcpInetHelperProvider()).UpdateProject(mainPrjId, name, description, owner, idUserRoles, idOrgRoles);
        }

        /// <summary>
        /// Get Organization for Project
        /// </summary>
        /// <param name="projectID"></param>
        /// <returns></returns>
        public static Dictionary<Guid, Organization> GetOrganizationForProject(int projectID)
        {
            return (new AcpInetHelperProvider()).GetOrganizationForProject(projectID);
        }

        /// <summary>
        /// Get Organization for ProjectId, rolename
        /// </summary>
        /// <param name="projectID"></param>
        /// <param name="rolename"></param>
        /// <returns></returns>
        public static Organization[] GetOrganizationForProject(int projectID, string rolename)
        {
            return (new AcpInetHelperProvider()).GetOrganizationForProject(projectID, rolename);
        }

        /// <summary>
        /// Get Organization for user
        /// </summary>
        /// <param name="projectID"></param>
        /// <returns></returns>
        public static Dictionary<Guid, Organization> GetOrganizationForUser(Guid userID)
        {
            return (new AcpInetHelperProvider()).GetOrganizationForUser(userID);
        }

        /// <summary>
        /// Get user list is not in any organization
        /// </summary>
        /// <returns></returns>
        public static Dictionary<Guid, User> GetUsersNotInAnyOrgan()
        {
            return (new AcpInetHelperProvider()).GetUsersNotInAnyOrgan();
        }

        /// <summary>
        /// Author: Hoang Van Tai 
        /// Get user information 
        /// </summary>
        /// <param name="PermitName"></param>
        /// <param name="username"></param>
        /// <returns></returns>
        public static User GetUserInfo(string PermitName, string username)
        {
            return (new AcpInetHelperProvider()).GetUserInfo(PermitName, username);
        }

        /// <summary>
        /// Author: Hoang Van Tai 
        /// Check User isExits in the AcpInet, input username is username or email  
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public static bool IsExistUserInAcpInet(string username)
        {
            return (new AcpInetHelperProvider()).IsExistUserInAcpInet(username);
        }

        /// <summary>
        /// Author: Hoang Van Tai 
        /// Check User isExits in the Application, input username is username   
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public static bool IsExistUser(string username)
        {
            return (new AcpInetHelperProvider()).IsExistUser(username);
        }

        /// <summary>
        /// Send request forgot password
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public static bool SendRequestForgotPassword(string userName, string linkReset)
        {
            return (new AcpInetHelperProvider()).SendRequestForgotPassword(userName, linkReset);
        }

        /// <summary>
        /// Check forgot code is existing
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static bool IsExistForgotCode(string code)
        {
            return (new AcpInetHelperProvider()).IsExistForgotCode(code);
        }

        /// <summary>
        /// Change password by code
        /// </summary>
        /// <param name="code"></param>
        /// <param name="passWord"></param>
        /// <returns></returns>
        public static bool ChangePassByCode(string code, string passWord)
        {
            return (new AcpInetHelperProvider()).ChangePassByCode(code, passWord);
        }

        /// <summary>
        /// Add role for project type
        /// </summary>
        /// <param name="ProjectTypeName"></param>
        /// <param name="RoleName"></param>
        /// <returns></returns>
        public static bool AddRoleForProjectType(string ProjectTypeName, string RoleName, string RoleDisplay, int? Priority = null)
        {
            return (new AcpInetHelperProvider()).AddRoleForProjectType(ProjectTypeName, RoleName, RoleDisplay, Priority);
        }

        /// <summary>
        /// Get all role for project type
        /// </summary>
        /// <param name="ProjectTypeName"></param>
        /// <returns></returns>
        public static string[] GetAllRolesForProjectType(string ProjectTypeName)
        {
            return (new AcpInetHelperProvider()).GetAllRolesForProjectType(ProjectTypeName);
        }

        /// <summary>
        /// Is Role Of User In the Project
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="username"></param>
        /// <param name="roleName"></param>
        /// <returns></returns>
        public static bool IsRoleOfUserInProject(int projectId, string username, string roleName)
        {
            return (new AcpInetRoleProvider()).IsRoleOfUserInProject(projectId, username, roleName);
        }

        /// <summary>
        /// Send mail
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="email"></param>
        /// <param name="subject"></param>
        /// <param name="body"></param>
        /// <returns></returns>
        public static bool SendMail(string userName, string email, string subject, string body)
        {
            return (new AcpInetHelperProvider()).SendMail(userName, email, subject, body);
        }
        
        /// <summary>
        /// Get Role List
        /// </summary>
        /// <param name="ispm"></param>
        /// <param name="prjtype"></param>
        /// <returns></returns>
        public static Role[] GetRoleList(string username, bool ispm = false, int prjtype = 0)
        {
            return (new AcpInetHelperProvider()).GetRoleList(username, ispm, prjtype);
        }

        /// <summary>
        /// Get All Role
        /// </summary>
        /// <returns></returns>
        public static Role[] GetAllRole()
        {
            return (new AcpInetHelperProvider()).GetAllRole();
        }
        
        /// <summary>
        /// Change Status OrganInProject
        /// </summary>
        /// <param name="orgID"></param>
        /// <param name="prjID"></param>
        /// <param name="status"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static int ChangeStatusOrganInProject(Guid orgID, int prjID, int status, ref string msgError)
        {
            return (new AcpInetHelperProvider()).ChangeStatusOrganInProject(orgID, prjID, status, ref msgError);
        }

        /// <summary>
        /// Search Organization SA
        /// </summary>
        /// <param name="OrgId"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static Organization[] SearchOrganizationSA(string OrgId, ref string msgError)
        {
            return (new AcpInetHelperProvider()).SearchOrganizationSA(OrgId, ref msgError);
        }

        /// <summary>
        /// Get Orgs List From User
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static Organization[] GetOrgsListFromUser(string userId, ref string msgError)
        {
            return (new AcpInetHelperProvider()).GetOrgsListFromUser(userId, ref msgError);
        }

        /// <summary>
        /// Get Organizations List Not OrgName
        /// </summary>
        /// <param name="orgName"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static Organization[] GetOrganizationsListNotOrgName(string orgName, ref string msgError)
        {
            return (new AcpInetHelperProvider()).GetOrganizationsListNotOrgName(orgName, ref msgError);
        }

        /// <summary>
        /// Add Organization
        /// </summary>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="organtype"></param>
        /// <param name="orgrole"></param>
        /// <param name="ownerid"></param>
        /// <param name="ownertype"></param>
        /// <param name="userInvite"></param>
        /// <param name="projecttype"></param>
        /// <param name="userNames"></param>
        /// <param name="idPrjRoles"></param>
        /// <param name="userRoles"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static Guid? AddOrganization(string name, string description, string organtype, string orgrole, string ownerid, string ownertype, string userInvite, string projecttype, string[] userNames, string[] idPrjRoles, string[] userRoles, ref string msgError)
        {
            return (new AcpInetHelperProvider()).AddOrganization(name, description, organtype, orgrole, ownerid, ownertype, userInvite, projecttype, userNames, idPrjRoles, userRoles, ref msgError);
        }

        /// <summary>
        /// Update Organization
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="organtype"></param>
        /// <param name="orgrole"></param>
        /// <param name="ownerid"></param>
        /// <param name="ownertype"></param>
        /// <param name="userInvite"></param>
        /// <param name="projecttype"></param>
        /// <param name="idUsers"></param>
        /// <param name="idPrjRoles"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static int UpdateOrganization(string orgId, string name, string description, string organtype, string orgrole, string ownerid, string ownertype, string userInvite, string projecttype, string[] idUsers, string[] idPrjRoles, ref string msgError)
        {
            return (new AcpInetHelperProvider()).UpdateOrganization(orgId, name, description, organtype, orgrole, ownerid, ownertype, userInvite, projecttype, idUsers, idPrjRoles, ref msgError);
        }

        /// <summary>
        /// Assign Users To Org
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="username"></param>
        /// <param name="userNames"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static int AssignUsersToOrg(Guid orgId, string username, string[] userNames, ref string msgError)
        {
            return (new AcpInetHelperProvider()).AssignUsersToOrg(orgId, username, userNames, ref msgError);
        }

        /// <summary>
        /// Add Users To Org
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="userInvite"></param>
        /// <param name="userNames"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static int AddUsersToOrg(Guid orgId, string userInvite, string[] userNames, ref string msgError)
        {
            return (new AcpInetHelperProvider()).AddUsersToOrg(orgId, userInvite, userNames, ref msgError);
        }

        /// <summary>
        /// Save Users Role To Org
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="userInvite"></param>
        /// <param name="userRoles"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static int SaveUsersRoleToOrg(Guid orgId, string userInvite, string[] userRoles, ref string msgError)
        {
            return (new AcpInetHelperProvider()).SaveUsersRoleToOrg(orgId, userInvite, userRoles, ref msgError);
        }

        /// <summary>
        /// Save Orgs Role To Prj
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="userInvite"></param>
        /// <param name="prjRoles"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static int SaveOrgsRoleToPrj(Guid orgId, string userInvite, string[] prjRoles, ref string msgError)
        {
            return (new AcpInetHelperProvider()).SaveOrgsRoleToPrj(orgId, userInvite, prjRoles, ref msgError);
        }

        /// <summary>
        /// Remove Users From Org
        /// </summary>
        /// <param name="idUserDels"></param>
        /// <param name="orgId"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static  int RemoveUsersFromOrg(string[] idUserDels, Guid orgId, ref string msgError)
        {
            return (new AcpInetHelperProvider()).RemoveUsersFromOrg(idUserDels, orgId, ref msgError);
        }

        /// <summary>
        /// Remove Projects From Org
        /// </summary>
        /// <param name="idPrjDels"></param>
        /// <param name="orgId"></param>
        /// <returns></returns>
        public static int RemoveProjectsFromOrg(string[] idPrjDels, Guid orgId)
        {
            return (new AcpInetHelperProvider()).RemoveProjectsFromOrg(idPrjDels, orgId);
        }

        /// <summary>
        /// Save Prjs Role To Org
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="userInvite"></param>
        /// <param name="idPrjDels"></param>
        /// <param name="PrjRoles"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static int SavePrjsRoleToOrg(string orgId, string userInvite, string[] idPrjDels, string[] PrjRoles, ref string message)
        {
            return (new AcpInetHelperProvider()).SavePrjsRoleToOrg(orgId, userInvite, idPrjDels, PrjRoles, ref message);
        }

        /// <summary>
        /// Get list Organization by SA
        /// </summary>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static Organization[] GetOrganizationsListBySA(ref string msgError)
        {
            return (new AcpInetHelperProvider()).GetOrganizationsListBySA(ref msgError);
        }

        /// <summary>
        /// Get list Organization and User is owner
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static  Organization[] GetOwnersList(string user)
        {
            return (new AcpInetHelperProvider()).GetOwnersList(user);
        }

        /// <summary>
        /// Add Orgs To User
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="userInviteID"></param>
        /// <param name="idOrgs"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static int AddOrgsToUser(Guid userId, string userInviteID, string[] idOrgs, ref string msgError)
        {
            return (new AcpInetHelperProvider()).AddOrgsToUser(userId, userInviteID, idOrgs, ref msgError);
        }

        /// <summary>
        /// Insert Invite Email Org
        /// </summary>
        /// <param name="emails"></param>
        /// <param name="OrgId"></param>
        /// <param name="RoleId"></param>
        /// <returns></returns>
        public static string InsertInviteEmailOrg(string emails, Guid OrgId, Guid? RoleId)
        {
            return (new AcpInetHelperProvider()).InsertInviteEmailOrg(emails, OrgId, RoleId);
        }

        public static string InsertInvite(string emails, Guid? RoleId, Guid? OwnerID)
        {
            return (new AcpInetHelperProvider()).InsertInvite(emails, RoleId, OwnerID);
        }

        /// <summary>
        /// Get Users List From Org
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static User[] GetUsersListFromOrg(string orgId, ref string msgError)
        {
            return (new AcpInetHelperProvider()).GetUsersListFromOrg(orgId, ref msgError);
        }

        /// <summary>
        /// Set Approved
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="isApproved"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static int SetApproved(Guid userId, bool isApproved, ref string msgError)
        {
            return (new AcpInetHelperProvider()).SetApproved(userId, isApproved, ref msgError);
        }

        /// <summary>
        /// Get User Owner By PrimaryKey
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static User GetUserOwnerByPrimaryKey(string userId, ref string msgError)
        {
            return (new AcpInetHelperProvider()).GetUserOwnerByPrimaryKey(userId, ref msgError);
        }

        /// <summary>
        /// Action Invite Organizations List
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="orgId"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public static  bool ActionInviteOrganizationsList(string userId, string orgId, int status)
        {
            return (new AcpInetHelperProvider()).ActionInviteOrganizationsList(userId, orgId, status);
        }

        /// <summary>
        /// Action Invite Projects List
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="prjId"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public static  bool ActionInviteProjectsList(string userId, int prjId, int status)
        {
            return (new AcpInetHelperProvider()).ActionInviteProjectsList(userId, prjId, status);
        }

        /// <summary>
        /// Search User SA
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static  User[] SearchUserSA(string keyword, ref string msgError)
        {
            return (new AcpInetHelperProvider()).SearchUserSA(keyword, ref msgError);
        }

        /// <summary>
        /// Get list user IsApproved or IsLockedOut
        /// </summary>
        /// <returns></returns>
        public static User[] GetListUserSA()
        {
            return (new AcpInetHelperProvider()).GetListUserSA();
        }

        /// <summary>
        /// Update Prj And Role
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="idPrjRoles"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static int UpdatePrjAndRole(Guid userId, string[] idPrjRoles, ref string message)
        {
            return (new AcpInetHelperProvider()).UpdatePrjAndRole(userId, idPrjRoles, ref message);
        }

        /// <summary>
        /// Add User
        /// </summary>
        /// <param name="user"></param>
        /// <param name="username"></param>
        /// <param name="name"></param>
        /// <param name="email"></param>
        /// <param name="phone"></param>
        /// <param name="password"></param>
        /// <param name="ownerid"></param>
        /// <param name="isApproved"></param>
        /// <param name="isSendEmail"></param>
        /// <param name="idOrgs"></param>
        /// <param name="idPrjRoles"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static Guid? AddUser(string user, string username, string name, string email, string phone, string password, string ownerid, string isApproved, string isSendEmail, string[] idOrgs, string[] idPrjRoles, ref string msgError)
        {
            return (new AcpInetHelperProvider()).AddUser(user, username, name, email, phone, password, ownerid, isApproved, isSendEmail, idOrgs, idPrjRoles, ref msgError);
        }

        /// <summary>
        /// Update User
        /// </summary>
        /// <param name="user"></param>
        /// <param name="userId"></param>
        /// <param name="name"></param>
        /// <param name="phone"></param>
        /// <param name="password"></param>
        /// <param name="email"></param>
        /// <param name="ownerid"></param>
        /// <param name="isApproved"></param>
        /// <param name="idOrgs"></param>
        /// <param name="idOrgDels"></param>
        /// <param name="idPrjRoles"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static  int UpdateUser(string user, string userId, string name, string phone, string password, string email, string ownerid, string isApproved, string[] idOrgs, string[] idOrgDels, string[] idPrjRoles, ref string msgError)
        {
            return (new AcpInetHelperProvider()).UpdateUser(user, userId, name, phone, password, email, ownerid, isApproved, idOrgs, idOrgDels, idPrjRoles, ref msgError);
        }

        /// <summary>
        /// Remove Orgs From User
        /// </summary>
        /// <param name="idOrgDels"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static int RemoveOrgsFromUser(string[] idOrgDels, Guid userId)
        {
            return (new AcpInetHelperProvider()).RemoveOrgsFromUser(idOrgDels, userId);
        }

        /// <summary>
        /// Add User To Projects
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="userInviteID"></param>
        /// <param name="idPrjRoles"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static int AddUserToProjects(Guid userId, string userInviteID, string[] idPrjRoles, ref string message)
        {
            return (new AcpInetHelperProvider()).AddUserToProjects(userId, userInviteID, idPrjRoles, ref message);
        }

        /// <summary>
        /// Get list user for project
        /// </summary>
        /// <param name="projetcId"></param>
        /// <returns></returns>
        public static User[] GetUsersForProject(int projetcId)
        {
            return (new AcpInetHelperProvider()).GetUsersForProject(projetcId);
        }
        
        /// <summary>
        /// Set Organ Be Owner User
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="orgId"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static int SetOrganBeOwnerUser(Guid userid, Guid orgId, ref string msgError)
        {
            return (new AcpInetHelperProvider()).SetOrganBeOwnerUser(userid, orgId, ref msgError);
        }

        /// <summary>
        /// Set Organ Be Owner User And Assign User To Org
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="orgId"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static int SetOrganBeOwnerUserAndAssignUserToOrg(Guid userid, Guid orgId, ref string msgError)
        {
            return (new AcpInetHelperProvider()).SetOrganBeOwnerUserAndAssignUserToOrg(userid, orgId, ref msgError);
        }

        /// <summary>
        /// Remove Request Be Owner
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="msgError"></param>
        /// <returns></returns>
        public static int RemoveRequestBeOwner(int Id, ref string msgError)
        {
            return (new AcpInetHelperProvider()).RemoveRequestBeOwner(Id, ref msgError);
        }

        /// <summary>
        /// Add user in application
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public static bool AddUserToApplication(string userName)
        {
            return (new AcpInetHelperProvider()).AddUserToApplication(userName);
        }

        /// <summary>
        /// Creat Service User To Application
        /// </summary>
        /// <returns></returns>
        public static bool SynServiceUserToApplication()
        {
            return (new AcpInetHelperProvider()).SynServiceUserToApplication();
        }
    }
}